//已完成
public class Test {
    public static void main(String[] args) {
        Solution s = new Solution();
        boolean ret = s.isPalindrome("A man, a plan, a canal: Panama");
        System.out.println(ret);
    }
}
class Solution {
    public boolean isPalindrome(String s) {
        StringBuffer sb = new StringBuffer();
        //sb.reverse();
        int len = sb.length();
        char[] chars = s.toCharArray();
        for(char c : chars){
            if((c>='a'&&c<='z')||(c>='A'&&c<='Z'||c>='0'&&c<='9')){
                sb.append(c);
            }
        }
        String str = sb.toString();
        String str2 = str.toLowerCase();
        char[] chars2 = str2.toCharArray();
        StringBuffer sb2 = new StringBuffer();
        for(char c : chars2){
            sb2.append(c);
        }

        String rev = sb2.reverse().toString();
        return rev.equals(str2);

    }
}